package 多态;

/**
 * @author Fang Ruichuan
 * @date 2022-12-07 20:52
 */

public class A {
    public void method() {
        System.out.println("父类方法");
    }
}

class B extends A {
    @Override
    public void method() {
        System.out.println("子类方法");
    }
}

class Main {
    public static void main(String[] args) {
        A a = new B();
        a.method();
    }
}

class C extends A {

}

class CMain {
    public static void main(String[] args) {
        A a = new C();
        a.method();
    }
}